define(function(require, exports, module) {
    var ALL = require("../../common/all"),
        CONFIG = ALL.CONFIG,
        METHOD = ALL.METHOD,
        Dialog = ALL.Dialog,
        Init = ALL.Init;

    var _vm = Init.initVue({
        data : {
            no : '',
            col_id : '',
            sort : 0,
            order : null,
            list : [],
            cur : 1,
            all : 0,
            search : false,
            oFlag: {
                '1': { flag: true },
                '2': { flag: true },
                '3': { flag: true },
                '4': { flag: true }
            }
        },
        methods: {
            reSearch : function() {
                this.search = true;
                this.getData(1);
            },
            reset : function() {
                this.search = false;
                this.no = '';
                this.col_id = '';
                this.sort = 0;
                this.order = null;
            },
            getData : function(n) {
                if (_vm.no && _vm.no.length != 12) {
                    METHOD.alert("交易号输入有误");
                    return;
                }

                var obj = {
                    page : n,
                    num : 10,
                    no : _vm.no,
                    col_id : _vm.col_id,
                    sort : _vm.sort,
                    order: _vm.order
                };

                METHOD.loading.show();
                METHOD.ajax("user/apply/list",obj).done(function(json){
                    METHOD.loading.hide();
                    _vm.list = json.data;
                    _vm.all = json.page.pages;
                }).fail(function(){
                    METHOD.loading.hide();
                });
            },
            setOrder : function(order) {
                var index = parseInt(order);

                _vm.order = index;
                _vm.oFlag[index].flag = !_vm.oFlag[index].flag;

                if (_vm.oFlag[index].flag) {
                    _vm.sort = 1;
                } else {
                    _vm.sort = 2;
                }
                _vm.getData(1);
            }
        }
    });

    _vm.no = METHOD.getQueryParms("no") || null;

    if (_vm.no) { _vm.search = true; }

    _vm.getData(1);

});

